<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>三国武将管理系统 - 登录</title>
    <style>
        /* 基础重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* 全局样式 */
        body {
            font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
            background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
            url('${pageContext.request.contextPath}/img.png') no-repeat center center fixed;
            background-size: cover;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            color: #f0f0f0;
            line-height: 1.6;
        }

        /* 登录容器 */
        .login-container {
            width: 380px;
            padding: 2.5rem;
            background: rgba(20, 20, 20, 0.5);
            border-radius: 12px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(8px);
            transform: translateZ(0);
            transition: all 0.3s ease;
        }

        .login-container:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
        }

        /* 标题样式 */
        .login-title {
            text-align: center;
            margin-bottom: 2rem;
            color: #d4a76a;
            font-size: 2.2rem;
            font-weight: bold;
            text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
            letter-spacing: 2px;
            position: relative;
            padding-bottom: 10px;
        }

        .login-title:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 3px;
            background: linear-gradient(to right, transparent, #d4a76a, transparent);
        }

        /* 表单组 */
        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: #d4a76a;
            font-size: 0.95rem;
        }

        .form-control {
            width: 100%;
            padding: 12px 15px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            color: #fff;
            font-size: 1rem;
            transition: all 0.3s;
        }

        .form-control:focus {
            outline: none;
            border-color: #d4a76a;
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 0 0 0 3px rgba(212, 167, 106, 0.2);
        }

        /* 按钮样式 */
        .btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(to right, #d4a76a, #b88746);
            color: #1a1a1a;
            border: none;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 0.5rem;
            letter-spacing: 1px;
        }

        .btn:hover {
            background: linear-gradient(to right, #b88746, #d4a76a);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            transform: translateY(-2px);
        }

        /* 消息样式 */
        .alert {
            padding: 0.75rem 1rem;
            margin-bottom: 1.5rem;
            border-radius: 6px;
            text-align: center;
            font-size: 0.9rem;
        }

        .alert-error {
            background: rgba(255, 80, 80, 0.15);
            border-left: 4px solid #ff5050;
            color: #ff8080;
        }

        .alert-message {
            background: rgba(80, 255, 80, 0.15);
            border-left: 4px solid #50ff50;
            color: #80ff80;
        }

        /* 注册链接 */
        .register-link {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.7);
        }

        .register-link a {
            color: #d4a76a;
            text-decoration: none;
            font-weight: bold;
            transition: color 0.3s;
            position: relative;
        }

        .register-link a:hover {
            color: #b88746;
        }

        .register-link a:after {
            content: '';
            position: absolute;
            width: 0;
            height: 1px;
            bottom: -2px;
            left: 0;
            background-color: #d4a76a;
            transition: width 0.3s;
        }

        .register-link a:hover:after {
            width: 100%;
        }

        /* 装饰元素 */
        .decoration {
            position: fixed;
            opacity: 0.05;
            z-index: -1;
            font-size: 8rem;
            user-select: none;
        }

        .decoration.top-left {
            top: 20px;
            left: 20px;
        }

        .decoration.bottom-right {
            bottom: 20px;
            right: 20px;
        }
    </style>
</head>
<body>
<!-- 装饰性元素 -->
<div class="decoration top-left">⚔</div>
<div class="decoration bottom-right">🛡</div>

<div class="login-container">
    <h1 class="login-title">三国武将管理系统</h1>

    <% if (request.getAttribute("error") != null) { %>
    <div class="alert alert-error"><%= request.getAttribute("error") %></div>
    <% } %>

    <% if (request.getAttribute("message") != null) { %>
    <div class="alert alert-message"><%= request.getAttribute("message") %></div>
    <% } %>

    <form action="user?action=login" method="post">
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" id="username" name="username" class="form-control" required placeholder="请输入用户名">
        </div>

        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" id="password" name="password" class="form-control" required placeholder="请输入密码">
        </div>

        <button type="submit" class="btn">登 录</button>
    </form>

    <div class="register-link">
        没有账号？<a href="user?action=register">立即注册</a>
    </div>
</div>
</body>
</html>